package com.piesat.quake.common.mqtt.decoder;

import com.piesat.quake.common.mqtt.decoder.common.CommonDecoder;
import com.piesat.quake.common.mqtt.decoder.entity.ReData;

public class ReDataDecoder extends CommonDecoder<ReData> {

    public ReDataDecoder(byte[] bytes) {
        super(bytes);
    }

    @Override
    public ReData decoder() {
        ReData data = new ReData();
        data.setType(this.readString(2));
        data.setLength(this.readIntegerLE());
        data.setId(this.readString(8));
        data.setLng(this.readFloatLE());
        data.setLat(this.readFloatLE());
        data.setStrain(this.readFloatLE());
        data.setAcceleration(this.readFloatLE());
        data.setModel(this.readByte());
        data.setVersion(this.readByte());
        return data;
    }
}
